<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	template="/WEB-INF/layout/t.xhtml">

	<ui:define name="title">
		<h:outputText value="Lista NewsLetterEmail" />
	</ui:define>
	<ui:define name="roles">
		<f:attribute name="roles" value="contactus" />
	</ui:define>
	<ui:define name="content">
		<h:form>
			<center>
				<p:panel header="Lista NewsLetterEmail">
					<h:panelGrid columns="5">
						<h:outputLabel for="name" value="Nome:" />
						<h:inputText id="name"
							value="#{newsLetterEmailController.search.obj.name}" />
						<h:outputLabel for="email" value="Email:" />
						<h:inputText id="email"
							value="#{newsLetterEmailController.search.obj.email}" />
						<p:commandButton
							actionListener="#{newsLetterEmailController.reloadAjax}"
							value="Cerca" ajax="true" immediate="false"
							update="contactusList" />
					</h:panelGrid>

					<br />

					<p:dataTable id="contactusList" rowIndexVar="rowIndex" var="t"
						value="#{newsLetterEmailController.model}"
						rows="#{newsLetterEmailController.pageSize}" paginator="true"
						dynamic="true">
						<p:column width="50">
							<h:outputText value="#{rowIndex+1}" />
						</p:column>

						<p:column width="300">
							<f:facet name="header">data</f:facet>
							<h:outputText value="#{t.data}">
								<f:convertDateTime pattern="dd/MM/yyyy HH:mm"
									timeZone="Europe/Rome" />
							</h:outputText>
						</p:column>
						<p:column width="300">
							<f:facet name="header">nome</f:facet>
							<p:cellEditor>
								<f:facet name="output">
									<h:outputText value="#{t.name}" />
								</f:facet>
								<f:facet name="input">
									<h:inputText required="true"
										requiredMessage="E' obbligatorio specificare un nome"
										value="#{t.name}" />
								</f:facet>
							</p:cellEditor>
						</p:column>

						<p:column width="300">
							<f:facet name="header">email</f:facet>
							<p:cellEditor>
								<f:facet name="output">
									<h:outputText value="#{t.email}" />
								</f:facet>
								<f:facet name="input">
									<h:inputText required="true"
										requiredMessage="E' obbligatorio specificare un'email"
										value="#{t.email}" />
								</f:facet>
							</p:cellEditor>
						</p:column>
						<p:column width="100">
							<f:facet name="header">operazioni</f:facet>
							<p:rowEditor>
							</p:rowEditor>
							<h:commandButton
								action="#{newsLetterEmailController.deleteInline}"
								value="Elimina" immediate="true"
								onclick="if (!confirm('Confermi l\'eliminazione?')) return false" />
						</p:column>
						<p:ajax event="rowEdit"
							listener="#{newsLetterEmailController.onRowEdit}" />
					</p:dataTable>
				</p:panel>

			</center>
		</h:form>
	</ui:define>
</ui:composition>